#include "game.h"

int incId = 0;
int portId = 4243;
Game::Game(std::string const &name, PortableNetworkManager *net)
{
  this->_name = name;
  this->_id = incId++;
  this->_network = net;
  this->_locked = false;
  this->_nbPlayers = 0;
 this->_port = portId++;
}

Game::Game()
{
  this->_locked = false;
  this->_id = incId++;
  this->_port = portId++;
  this->_nbPlayers = 0;
  this->_network = new PortableNetworkManager();
}

Game::~Game()
{
}

void Game::setNetwork(PortableNetworkManager *p)
{
  this->_network = p;
}

PortableNetworkManager *Game::getNetwork()
{
  return this->_network;
}

int	Game::getId() const
{
  return this->_id;
}

void	Game::setId(int id)
{
  this->_id = id;
}

std::string	const &Game::getName() const
{
  return this->_name;
}

void	Game::setName(std::string const &name)
{
  this->_name = name;
}

void			Game::addPlayers(Player *p){
  this->_network->addPlayer(p);
  this->_nbPlayers++;
}
